package com.lion.common.modules.uaa.web.models.params;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author Chris Chan
 * Create On 2025/8/8 上午11:52
 * Use for:
 * Explain:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "手机号验证码登录参数")
public class LoginByMobileVerifyCodeParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
    @Schema(description = "手机号",example = "13811111111")
    private String mobile;

    @NotBlank(message = "验证码不能为空")
    @Schema(description = "验证码",example = "9527")
    private String verifyCode;

    public static LoginByMobileVerifyCodeParam create(String mobile, String verifyCode) {
        return new LoginByMobileVerifyCodeParam(mobile, verifyCode);
    }

    public static LoginByMobileVerifyCodeParam of(String mobile, String verifyCode) {
        return new LoginByMobileVerifyCodeParam(mobile, verifyCode);
    }
}
